//
//  ExplorationListTableViewCell.m
//  TestApplication
//
//  Created by Hanlingyu on 16/8/31.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "ExplorationListTableViewCell.h"
#import "ExplorationListContent.h"
#import "ExplorationListModel.h"
#import "ExplorationListJoin.h"
#import "UIImageView+WebCache.h"

@implementation ExplorationListTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    
    self.contentView.backgroundColor = [UIColor colorWithWhite:0.917 alpha:1.000];
    _backView = [[UIView alloc] init];
    _backView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:_backView];
    
    
    _listContentImage = [[UIImageView alloc] init];
//    _listContentImage.backgroundColor = [UIColor yellowColor];
    [_backView addSubview:_listContentImage];
    
    _titleLabel = [[UILabel alloc] init];
//    _titleLabel.backgroundColor = [UIColor grayColor];
    _titleLabel.font = [UIFont systemFontOfSize:14];
    [_backView addSubview:_titleLabel];
    
    _contentLabel = [[UILabel alloc] init];
//    _contentLabel.backgroundColor = [UIColor grayColor];
    _contentLabel.font = [UIFont systemFontOfSize:12];
    _contentLabel.textColor = [UIColor lightGrayColor];
    [_backView addSubview:_contentLabel];
    
    _typeImageView = [[UIImageView alloc] init];
//    _typeImageView.backgroundColor = [UIColor yellowColor];
    [_backView addSubview:_typeImageView];
    
}

- (void)setListContent:(ExplorationListContent *)listContent {
    _listContent = listContent;
    [_listContentImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://qn.zheli.io/%@", _listContent.img]]];
    _titleLabel.text = _listContent.content;
    _contentLabel.text = _listContent.desc;
    if (_listContent.join.status == 3) {
        _typeImageView.image = [UIImage imageNamed:@"channelCamera"];
    } else if (_listContent.join.status == 2) {
        _typeImageView.image = [UIImage imageNamed:@"channelVoice"];
    } else {
        _typeImageView.image = [UIImage imageNamed:@"editAddress"];
    }
}

- (void)layoutSubviews {
    [super layoutSubviews];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
